<template>
    <div class="upload-box">
        <el-upload
            ref="uploadFile"
            :action="uploadImage"
            name="images"
            class="left-view"
            :on-success="uploadSuccess"
            :on-error="uploadError"
        >
            <img v-if="bannerUrl" :src="bannerUrl" class="avatar" />
            <el-icon v-else class="avatar-uploader-icon">
                <Plus />
            </el-icon>
        </el-upload>
    </div>
</template>

<script setup>
import { ref } from 'vue'
import { uploadImage } from '@/api/user'
const bannerUrl = ref('')
const uploadSuccess = (response, file, fileList) => {
    console.log(response)
    console.log(file)
    console.log(fileList)
}

const uploadError = (err, file, fileList) => {
    console.log('uploadError', err)
}
</script>

<style scoped></style>
